package com.ruoyi.system.util;

public class ChargeCalculator {
    private static final int HOURLY_RATE = 5;
    private static final int HOURLY_MAIN = 2;
    public int calculateCharge(Car car, long leaveTime) {


        long enterTime = car.getEnterTime();

        long parkingTime = leaveTime - enterTime;

        int hours = (int) Math.ceil(parkingTime / (1000.0 * 60 * 60));

        int charge = hours * HOURLY_RATE;

        return charge;
    }
    public int calculateIMD(Car car, long leaveTime) {


        long enterTime = car.getEnterTime();

        long parkingTime = leaveTime - enterTime;

        int hours = (int) Math.ceil(parkingTime / (1000.0 * 60 * 60));

        int charge = hours * HOURLY_MAIN;

        return charge;
    }
}
